@section('content')
<div class="am-g m-user">
	<div class="am-u-md-12">
		<div class="m-user-title am-cf">
			<h1>密码修改</h1>
			<!-- 
			<span class="free-tip">订单满500元免运费</span>
			 -->
		</div>
	</div>
	<div class="am-u-md-12">
		
		<div class="m-user-bd am-margin-top">
			<div class="m-login am-cf">
				<div class="m-login-bd">
					<div class="m-register">
						<form class="am-form"  id="reset-password-form" name="reset-password-form" method="post" 
								action="{{URL::to('password/reset')}}">
							<div class="am-form-group">
						      <label for="password">新密码<span class="m-required">*</span></label>
							<div class="am-cf m-horizontal-group">
						      <input type="password" class="m-input validate" id="password" name="password" 
								data-rules="required|max_length[64]|alpha_dash|matches[password_confirmation]" data-display="新密码" placeholder="输入新密码">
				              <span class="m-field-error"></span>
				            </div>
						    </div>
							<div class="am-form-group">
						      <label for="password_confirmation">确认密码<span class="m-required">*</span></label>
							  <div class="am-cf m-horizontal-group">
						      <input type="password" class="m-input validate" id="password_confirmation " name="password_confirmation" 
									data-rules="required" data-display="确认密码" placeholder="输入确认密码">
								 <span class="m-field-error"></span> 
							  </div>
							</div>
							{{Form::token()}}
							<input name="id" type="hidden" value="{{$user->id}}"/>
							<input name="referer" type="hidden" value="{{$referer}}"/>
						    <p><button type="submit" class="m-btn" data-am-loading="{spinner: 'circle-o-notch', loadingText: '保存中...', resetText: '保存成功',errorText:'保存失败'}">保存</button></p>
						    <p class="m-form-error"></p>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
    </div>
</div>

@stop
@section('script')
<script type="text/javascript">
  $(function(){
	  var $form = $("#reset-password-form");
	  var $submit = $form.find('button');
	  var errorFn = function(errors){
			$form.find(".m-field-error").html("");
			if ($.isArray(errors)){
				  $.each(errors,function(i,e){
					  var $msg = $(e.element).next();
					  $msg.text(e.message);
				  });
			  } else {
				  for (var key in errors){
					  var $ele = $form.find("#"+key).next();
					  $ele.text(errors[key][0]);
				  }
			}
		}
	  $form.validate(function($form,errors,events){
			errorFn(errors);
	  });
  });

</script>
@stop
